import { http } from '@/utils/request'
import type { ITrademark, TrademarkItem } from '@/api/types'

export const reqTrademarkList = (page: number, limit: number) => {
  return http<ITrademark>(`/admin/product/baseTrademark/${page}/${limit}`, 'GET')
}

export const addTrademark = ({ logoUrl, tmName }: TrademarkItem) => {
  return http('/admin/product/baseTrademark/save', 'POST', {
    logoUrl,
    tmName
  })
}

export const delTrademark = (id: number) => {
  return http(`/admin/product/baseTrademark/remove/${id}`, 'DELETE')
}

export const updateTrademark = ({ id, tmName, logoUrl }: TrademarkItem) => {
  return http('/admin/product/baseTrademark/update', 'PUT', {
    id,
    tmName,
    logoUrl
  })
}

export const detailTrademark = (id: string) => {
  return http<TrademarkItem>(`/admin/product/baseTrademark/get/${id}`, 'GET')
}

export const reqAllTrademark = () => {
  return http<TrademarkItem[]>('/admin/product/baseTrademark/getTrademarkList', 'GET')
}
